home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr30 / modcpi10.zip / MODCPI.DOC < prev    next >
Text File  |  1993-04-13  |  19KB  |  352 lines

  1.                                                                   13 April 1993
  2.  
  3.          ╔══════════════════════════════════════════════════════════╗
  4.          ║               MODCPI 1.00 and DUMPCPI 1.00               ║
  5.          ║ Copyright 1993 by Rufus S. Hendon.  All rights reserved. ║
  6.          ╚══════════════════════════════════════════════════════════╝
  7.  
  8.                                ┌──────────────┐
  9.                                │ Introduction │
  10.                                └──────────────┘
  11.  
  12.    Systems using a VGA video board and MS-DOS version 3.3 or higher allow you
  13. to use screen fonts with different character sets by switching between what
  14. are called "code pages".  The fonts are contained in a "code-page information
  15. file" with the extension .CPI.  The code-page information file containing the
  16. standard fonts for the VGA is called EGA.CPI.
  17.  
  18.    The screen fonts for a given code page provide a set of 256 characters that
  19. is different in toto from the set of characters used by other code pages.  (For
  20. this reason, "code pages" are also referred to as "character sets".)  The
  21. character sets of the standard code pages do, however, overlap a good deal; in
  22. particular, the first 127 characters are the same in all the character sets.
  23. In EGA.CPI, three fonts are supplied for each code page, all with the same
  24. character set.  In all three fonts, the characters are 8 pixels wide, but they
  25. differ in height:  in one font the characters are 16 pixels high, in one they
  26. are 14 pixels high, and in the third they are 8 pixels high.  Which of the
  27. three fonts is used to display text on the screen depends on the video mode
  28. and the number of lines shown on the screen.  With a VGA board, for example,
  29. the 16x8 font is used with a 25-line screen, the 14x8 font with a 28-line
  30. screen, and the 8x8 font with a 43-line or 50-line screen.  The 16x8 font is
  31. sometimes called the "VGA font" and the 14x8 font the "EGA font".
  32.  
  33.    Code pages are identified by numbers.  MS-DOS 6.0 supports these six code
  34. pages (the name of the character set associated with the code page is shown in
  35. parentheses):
  36.  
  37.          437 (English)                          860 (Portuguese)
  38.          850 (Multilingual [Latin I])           863 (Canadian-French)
  39.          852 (Slavic (Latin II])                865 (Nordic)
  40.  
  41. (The EGA.CPI file supplied with earlier versions of MS-DOS that support code-
  42. page switching may lack fonts for code page 852.)
  43.  
  44.    Although MS-DOS recognizes five or six code pages, it only allows you to
  45. switch between two code pages.  Which two you have access to depends on the
  46. country setting in effect.  By default, the country setting specifies country
  47. code 001, "English (United States)"; you may set your system to a different
  48. country code by including a "COUNTRY=" line in your CONFIG.SYS file.  If the
  49. country setting is 001, the only two code pages you can use are 437 and 850;
  50. as long as this setting is in effect, MS-DOS won't allow you to switch to the
  51. Canadian-French code page, 863, or the Slavic code page, 852.  If you need the
  52. Slavic code page, you can gain access to it by setting your system to country
  53. code 048, "Polish", in CONFIG.SYS, but then you are restricted to code pages
  54. 852 and 850 -- you can't switch to 437, for example.
  55.  
  56.    MS-DOS considers one of the two code pages for a given country code to be
  57. the "preferred character set" while the other is the "alternate character
  58. set".  For country code 001, 437 is the preferred code page, 850 the alternate;
  59. for country code 850 ("Dutch"), on the other hand, 850 is the preferred code
  60. page, 437 the alternate.
  61.  
  62.    The purpose of ModCPI is to relax these restrictions somewhat in order to
  63. make code-page switching more useful.  It can't change the fact that for a
  64. given country code you are limited to two specific code pages, but it does
  65. make it possible to alter the actual fonts associated with those code pages,
  66. so that in practice you can have two fonts with completely different character
  67. sets between which you can switch by using the DOS CHCP ("change code page")
  68. command.  One thing ModCPI can do is to alter the associations of the existing
  69. fonts with code pages.  For country setting 001, for example, you can leave the
  70. font associated with code page 437 unchanged while replacing the font
  71. associated with code page 850 by the Slavic font normally associated with code
  72. page 852.  You can also substitute a font of your own for the standard font
  73. assigned to a code page; if, for example, you have used a screen-font editor to
  74. design a Russian font or have acquired such a font in some other way, you can
  75. make it the font associated with code page 850, so that when you change to code
  76. page 850 text will be displayed in Russian characters on the screen.
  77.  
  78.  
  79.              ┌──────────────────────────────────────────────────┐
  80.              │ How to use ModCPI to create a modified .CPI file │
  81.              └──────────────────────────────────────────────────┘
  82.  
  83.    ModCPI creates, from an existing .CPI file, a new .CPI file in which the
  84. font for one of the code pages is replaced by a different font.  The replace-
  85. ment font can be either one of the fonts for a different code page in the
  86. existing .CPI file or a custom-designed font stored in a separate file.
  87.  
  88.    ModCPI requires four arguments:
  89.  
  90.    (1) The name of the code-page information file from which a modified file is
  91. to be created.
  92.  
  93.    (2) The name to be given to the modified code-page information file.
  94.  
  95.    (3) The number of the code page whose font is to be replaced.  This must be
  96. a code page that is valid for the current country setting, since MS-DOS won't
  97. let you use a code page that isn't valid for the country setting.
  98.  
  99.    (4) A specification of the source of the replacement font.  If the font for
  100. some other code page in the file specified by the first argument is to be used,
  101. this argument is the number of the code page whose font is to be copied as the
  102. replacement font.  (This may be a code page that isn't valid for the current
  103. country setting.)  If the font is to be read from a file, this argument is the
  104. name of the file.
  105.  
  106.    When the replacement font comes from the same .CPI file, all three sizes of
  107. the font are replaced (8x16, 8x14, and 8x8), and hence the replacement font
  108. will be used both with the normal display of 25 lines per screen and when the
  109. system is set to display more than 25 lines.  When the replacement font is
  110. supplied in a file, only the VGA 8x16 font is replaced, so that the replacement
  111. is effective only for the standard 25-line display.  (The file is expected to
  112. contain only an 8x16 font, which means that the file must be exactly 4096 bytes
  113. long.)
  114.  
  115.    Here are two examples:
  116.  
  117.    (1) If you want to have the Slavic font available as the alternate font with
  118. country code 001, you can create a copy of EGA.CPI in which the Slavic font
  119. taken from code page 852 is substituted for the font for code page 850 (since
  120. 850 is the only other code page you're allowed to use besides 437 when the
  121. country code is 001).  To do this, with the result written into SLAVIC.CPI, you
  122. would issue this command:
  123.  
  124.                 modcpi c:\dos\ega.cpi c:\dos\slavic.cpi 850 852
  125.  
  126.    (2) If you have used a font editor to create a VGA 8x16 font with Greek
  127. characters (or have acquired such a font from someone else) and the font is
  128. stored in GREEK.VGA, you can create a copy of EGA.CPI called GREEK.CPI in which
  129. the 8x16 font for code page 850 is replaced by the Greek font by issuing this
  130. command:
  131.  
  132.           modcpi c:\dos\ega.cpi c:\dos\greek.cpi 850 c:\dos\greek.vga
  133.  
  134.    If you want to replace the fonts associated with both the code pages that
  135. the country code you use makes available, you can do so by invoking ModCPI
  136. twice.  Suppose, for example, that you want to substitute the Slavic character
  137. set (associated with code page 852 in EGA.CPI) for the font normally associated
  138. with code page 437 (so that you can edit Polish text) and a Cyrillic font
  139. (stored in CYRILLIC.VGA) for the font normally associated with code page 850
  140. (so that you can edit Russian text).  To accomplish this, you would first
  141. create a temporary .CPI file with the Slavic font copied from code page 852 in
  142. EGA.CPI to code page 437 and then use this temporary .CPI file as the basis for
  143. creating the final .CPI file with the font for code page 850 replaced by
  144. CYRILLIC.VGA.  The temporary .CPI file would then be erased.  Here are the
  145. necessary commands:
  146.  
  147.        modcpi c:\dos\ega.cpi c:\dos\temp.cpi 437 852
  148.        modcpi c:\dos\temp.cpi c:\dos\polruss.cpi 850 c:\dos\cyrillic.vga
  149.        del c:\dos\temp.cpi
  150.  
  151.  
  152.                       ┌─────────────────────────────────┐
  153.                       │ How to use a modified .CPI file │
  154.                       └─────────────────────────────────┘
  155.  
  156.    The procedure for using a modified .CPI file created by ModCPI is the same
  157. as when you use the standard EGA.CPI to switch between code pages.  There are
  158. four parts to the procedure:  (1) Certain lines must be added to CONFIG.SYS
  159. in order to make code-page switching possible; this has to be done only once.
  160. (2) At the beginning of each session, the DOS TSR program NLSFUNC, which
  161. provides the ability to switch between code pages, must be loaded into memory.
  162. (3) The fonts from the modified .CPI file must also be loaded into memory.
  163. (4) As often as required during the session, the DOS command CHCP is issued to
  164. change to whichever of the two available code pages you want text to be
  165. displayed in.
  166.  
  167.  
  168. (1) Modifying CONFIG.SYS
  169.  
  170.    Two lines must be added to CONFIG.SYS.  In this discussion, I assume that
  171. the necessary system files are stored in C:\DOS.  If this isn't true in your
  172. case, change "C:\DOS" to the correct path.
  173.  
  174.    The first line takes this form:
  175.  
  176.                         COUNTRY=nnn,,C:\DOS\COUNTRY.SYS
  177.  
  178. Replace "nnn" by the country code you want to put into effect.  The country
  179. code determines which two code pages MS-DOS will allow you to access.  Even if
  180. the code you want to be in effect is 001, "English (United States)", which is
  181. the default, you still must include this line in CONFIG.SYS in order to enable
  182. the code-page switching apparatus.
  183.  
  184.    The second line takes this form:
  185.  
  186.                    DEVICE=C:\DOS\DISPLAY.SYS CON=(EGA,nnn,1)
  187.  
  188. "EGA" specifies the kind of video adapter in the system; "EGA" is a generic
  189. term that includes both EGA and VGA.  "nnn" is the number of the preferred
  190. character set (code page) for the country code specified in the "COUNTRY="
  191. line.  If, for example, the country code is 001, "nnn" would be 437.  "1"
  192. specifies how many additional code pages are to be allowed for; since MS-DOS
  193. only gives you access to two code pages, there is no point to specifying
  194. anything except "1".
  195.  
  196.    For "English (United States)", the actual lines would look like this:
  197.  
  198.                    country=001,,c:\dos\country.sys
  199.                    device=c:\dos\display.sys con=(ega,437,1)
  200.  
  201.    As is always the case with changes to CONFIG.SYS, these additions won't
  202. take effect until you reboot the computer.
  203.  
  204.  
  205. (2) Loading NLSFUNC
  206.  
  207.    The ability to switch code pages is provided by NLSFUNC.EXE.  The command
  208.  
  209.                                     nlsfunc
  210.  
  211. must therefore be issued to activate this ability before you can actually
  212. switch from one code page to another.  Issuing this command causes NLSFUNC to
  213. be loaded into memory as a "terminate-and-stay-resident" (TSR) program.  The
  214. command should be issued only once during any given session.  If you make
  215. regular use of code-page switching, you'll probably want to put the command in
  216. your AUTOEXEC.BAT file so that it will be automatically executed at the
  217. beginning of every session.
  218.  
  219.  
  220. (3) Loading the fonts from the modified .CPI file
  221.  
  222.    After NLSFUNC has been loaded, it is necessary to load fonts from a .CPI
  223. file for the two available code pages.  This is true regardless of whether the
  224. standard .CPI file or a modified .CPI file is to be used.
  225.  
  226.    The command to load fonts from a .CPI file takes this form:
  227.  
  228.                           MODE CON CP PREP=((nnn)fn)
  229.  
  230. "nnn" is the number of the alternate code page for the current country code
  231. (the number of the code page that wasn't specified in the CONFIG.SYS line for
  232. DISPLAY.SYS).  If, for example, the country code is 001, "English (United
  233. States)", and the line for DISPLAY.SYS in CONFIG.SYS specifies CON=(EGA,437,1),
  234. "nnn" will be 850, the other of the two code pages, 437 and 850, that are valid
  235. for country code 001.  "fn" is the name of the .CPI file from which the fonts
  236. are to be loaded.  If the fonts are to be loaded from a modified .CPI file
  237. named C:\DOS\GREEK.CPI, for instance, the following command would be issued:
  238.  
  239.                    mode con cp prep=((850)c:\dos\greek.cpi)
  240.  
  241.    You can load fonts from different .CPI files at different points in the same
  242. session.  If, for example, you have, in addition to C:\DOS\GREEK.CPI with a
  243. Greek font for code page 850, a file called C:\DOS\RUSSIAN.CPI with a Russian
  244. font for code page 850, you can, after issuing the command shown above to
  245. install the Greek font, issue the command
  246.  
  247.                   mode con cp prep=((850)c:\dos\russian.cpi)
  248.  
  249. to load the Russian font, which will replace the Greek font as the font
  250. associated with code page 850.  You can also specify the standard .CPI file to
  251. switch back to the standard fonts for code pages 437 and 850:
  252.  
  253.                     mode con cp prep=((850)c:\dos\ega.cpi)
  254.  
  255.    If you normally load non-standard fonts only once during each session, you
  256. might find it convenient to put the MODE command in the AUTOEXEC.BAT file, so
  257. that it will be executed automatically every time you start the computer.  If
  258. you put both the NLSFUNC and the MODE command in AUTOEXEC.BAT, the NLSFUNC
  259. command must precede the MODE command.
  260.  
  261.  
  262. (4) Switching between code pages
  263.  
  264.    After you have used the MODE command to load screen fonts from a particular
  265. .CPI file, the system displays text in the font for the preferred code page for
  266. the country code currently in effect.  (The preferred code page is the one you
  267. specified in the DISPLAY.SYS line in CONFIG.SYS.)  You can then, whenever you
  268. wish, switch between the preferred code page and the alternate code page by
  269. using the DOS "change code page" command, CHCP.  If, for example, the two
  270. available code pages are 437 and 850, the command
  271.  
  272.                                    chcp 850
  273.  
  274. causes text to be displayed in the font associated with code page 850, and
  275. the command
  276.  
  277.                                    chcp 437
  278.  
  279. switches back to the font associated with code page 437.
  280.  
  281.  
  282.            ┌───────────────────────────────────────────────────────┐
  283.            │ Using DumpCPI to obtain information about a .CPI file │
  284.            └───────────────────────────────────────────────────────┘
  285.  
  286.    Another program, called DumpCPI, is supplied with ModCPI.  DumpPCI reports
  287. information about a code-page information file.  A single argument giving the
  288. name of the code-page information file to be dumped is required.  The report is
  289. displayed on the screen, but may be redirected to a file.  For example, to
  290. write information about the standard code-page information file for the VGA,
  291. EGA.CPI, into the file EGACPI.DMP, you would issue this command:
  292.  
  293.                       dumpcpi c:\dos\ega.cpi >egacpi.dmp
  294.  
  295.    The report gives the name of the file, the number of code pages, and, for
  296. each code page, the code-page number, the number of fonts, and, for each font,
  297. the character height and width and the number of characters.
  298.  
  299.    The offsets of each code page and each font are also given.  In the case of
  300. fonts, the offset is the offset of the six-byte font header, which has this
  301. structure:
  302.  
  303.          one byte = character bitmap height, in pixels (16, 14, or 8)
  304.          one byte = character bitmap width, in pixels (always 8)
  305.          one byte = "relative height" (always 0)
  306.          one byte = "relative width" (always 0)
  307.          one word = number of characters (normally 256)
  308.  
  309. The array of bitmaps constituting the font begins at the specified offset + 6.
  310. The number of bytes per bitmap is equal to the bitmap height specified in the
  311. font header.  The total length of the font is that number times the number of
  312. characters specified in the font header.
  313.  
  314. ===============================================================================
  315.                                     NOTICE
  316.  
  317.    ModCPI and DumpCPI are copyrighted programs, the distribution and use of
  318. which are controlled by the author and copyright owner, Rufus S. Hendon.  These
  319. programs are not in the public domain.
  320.  
  321.    You may use the ModCPI and DumpCPI programs and this documentation file for
  322. your own private, non-commercial purposes; there is no registration fee or
  323. other type of charge for such use.  You may give copies of the programs to
  324. other individuals for their private, non-commercial use, provided that such
  325. copies include both the program files (MODCPI.EXE and DUMPCPI.EXE) and this
  326. documentation file (MODCPI.DOC) in unaltered form and provided that you neither
  327. request nor accept remuneration in any form for the copies.
  328.  
  329.    Commercial distribution of ModCPI and DumpCPI is forbidden unless there has
  330. been prior approval by the copyright owner and the payment of a license fee.
  331. Prohibited forms of commercial distribution include the bundling of the
  332. programs with commercially distributed products such as software and books, the
  333. distribution of the programs as part of a "premium" for magazine subscribers,
  334. the distribution of the programs by companies that sell collections of
  335. "freeware" and "shareware" programs on disks, and the posting of the programs
  336. on electronic bulletin boards maintained by vendors of commercial products in
  337. support of those products.
  338.  
  339.    ModCPI and DumpCPI are made available without warranty of any kind.  The
  340. copyright owner is not liable for any damages resulting from the use of the
  341. programs.
  342.  
  343. ===============================================================================
  344.  
  345.    Communications may be sent to me at this address:
  346.  
  347.                              Rufus S. Hendon
  348.                              804 Still Hill Road
  349.                              Hamden, CT 06518-1105
  350.  
  351. Electronic mail may be sent to userid 73250,2674 on CompuServe.
  352.